package org.example.addr.controller;

import org.example.addr.domain.Addr;
import org.example.addr.service.AddrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("addr")
public class AddrController {
    @Autowired
    private AddrService addrService;
    @RequestMapping("list")
    public  List<List<Double>> getDataFromDBWithMyBatis(){
        List<List<Double>> lineArr = new ArrayList<>();
        List<Addr> list = addrService.list();
        for (Addr addr : list) {
            lineArr.add(Arrays.asList(addr.getLongitude(),addr.getLatitude()));
        }
        System.out.println(lineArr);
        return lineArr;
    }
}
